package firstquestion;

import java.util.Scanner;

public class TestStudent {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        boolean exit;
        do {
            exit=true;
            System.out.println("请选择您的操作：");
            System.out.println("1,显示全部学员 2,删除 3,增加 4,修改 0,退出");
            int num = scanner.nextInt();
            switch (num) {
                case 1:
                    StudentMessageManage.showStudent();
                    exit=false;
                    break;
                case 2:
                    System.out.println("请问你要删除哪位学生");
                    String name = scanner.next();
                    StudentMessageManage.delete(name);
                    exit=false;
                    break;
                case 3:
                    System.out.println("请输入要学生id");
                    int sno = scanner.nextInt();
                    System.out.println("请输入学生姓名：");
                    String name1 = scanner.next();
                    System.out.println("请输入学生年龄:");
                    int age = scanner.nextInt();
                    System.out.println("请输入学生身份证号");
                    String idcard = scanner.next();
                    Student student = new Student(sno, name1, age, idcard);
                    StudentMessageManage.add(student);
                    exit=false;
                    break;
                case 4:
                    System.out.println("请输入要学生id");
                    int sno1 = scanner.nextInt();
                    System.out.println("请输入学生姓名：");
                    String name2 = scanner.next();
                    System.out.println("请输入学生年龄:");
                    int age1 = scanner.nextInt();
                    System.out.println("请输入学生身份证号");
                    String idcard1 = scanner.next();
                    Student student1 = new Student(sno1, name2, age1, idcard1);
                    StudentMessageManage.update(student1);
                    exit=false;
                    break;
                case 0:
                    StudentMessageManage.exit();
                    exit=true;
                    break;
                default:
                    System.out.println("输入无效");
                    break;

            }
        }while (!exit);
    }
}
